1. Field of the Invention
The present invention relates generally to graphics systems, and more particularly to texture filtering for 3D graphics with screen pixel digitization at variable sampling rates.
2. Description of the Background Art
A texture is a digital image, typically rectangular in shape, having a (u, v) coordinate space. The smallest addressable unit of a texture is a texel, which is located at a particular coordinate in the (u, v) coordinate system. In a texture mapping operation, a texture is mapped to the surface of a graphical model as the model is rendered to create a destination image. In the destination image, pixels are located at particular coordinates in the (x, y) coordinate system.
In texture mapping, data is sampled from the texture to compute an intensity value for a pixel in the destination image. The sampled texels for a given pixel are typically identified by mapping a point in the destination image into the texture. Texels neighboring the mapped point in the texture are then sampled, weighted, and summed to compute the intensity value for a pixel. The process is then repeated for additional pixels in the destination image.
Various texture reconstruction filtering techniques may be used to reduce blocky appearance and aliasing noise in textures while applying perspective effects to produce a smoother and more realistic destination image. Such texture filtering techniques include box filtering (point sampling or any box filter), bilinear filtering, trilinear filtering, and anisotropic filtering.
Filtering with the box filter (point sampling) technique is the most basic method for texture mapping and determining the attributes, such as color, of a pixel from the texture maps. Point sampling uses the nearest texel value mapped to a particular pixel to determine the pixel attribute. For example, assume that a given pixel location at coordinates (x, y) is mapped to particular texture coordinates (u, v). The texture coordinates (u, v) may include fractional values. However, in point sampling, the texture coordinate assigned to the pixel will be the nearest integer value. Thus, if a given pixel is mapped to texture coordinates (u, v)=(1.2, 1.9), the point sampling technique will assign a texel with texture coordinates (uxe2x80x2, vxe2x80x2) to the given pixel with the texture coordinates (uxe2x80x2, vxe2x80x2) being based on the nearest integer value: (uxe2x80x2, vxe2x80x2)=(1, 2).
Bilinear filtering involves interpolating the attribute values of four surrounding discrete texels to calculate the attribute value of a new texel which is then assigned to a particular pixel. The process is then repeated for each pixel forming the object being textured. The bilinear filtering technique provides reasonably realistic images and improved image quality over the point sampling filtering technique.
Trilinear filtering involves the use of multiple texture maps or MIP maps at various levels of depth. Bilinear filtering is preformed in each MIP map level, resulting in a new texel for each MIP map level. The actual attribute value for a pixel is then determined by performing another interpolation step between the two new texels associated with two particular MIP map levels, resulting in an interpolation process in three dimensions.
Anisotropic filtering involves taking samples of texels in the texture with the samples chosen according to the shape of the pixel xe2x80x9cfootprintxe2x80x9d in the texture space. Thus, the shape of the region of the texels that are sampled varies as circumstances dictate.
These various texture-filtering algorithms do not address the problem of variable sampling rate or other non-standard graphics processes. When sections of a scene are sampled at varying sampling rates, it is desirable to appropriately modify the characteristics of the texture filter. Otherwise, the effective filter characteristics will not be consistent over the entire scene, resulting in undesirable artifacts.
Further, when a scene is super-sampled, a convolution is effectively performed for the post-filter and the texture reconstruction filter. The characteristics of the resulting higher-order filter typically matches the characteristics of a filter used for coarse sampling. Without this matching of filter characteristics, banding will occur in the image due to the additional filtering applied to aggregate dense samples resulting in different passbands in the areas with the different sampling rates.
Additionally, in conventional systems, the texture-filtering model is typically pre-specified in each particular application. Conventional systems do not provide a texture filter that varies the filter characteristics in response to, for example, the rate of sampling and the extent of texture warping. Such deficiencies of conventional systems lead to images that are generated with undesirable artifacts. Therefore, there is a need for a matched texture filter design for varying sample rates.
The present invention provides in various embodiments a texture filter that takes into account the sampling rate and the non-linear mapping between screen coordinates and texture coordinates. In particular, these embodiments of the present invention provide a matched texture filter that continuously changes the pass bandxe2x80x94stop band characteristics based upon the rate of sampling of polygon data and the extent of perspective warping introduced by the non-linear screen-to-texture mapping function. The matched texture filter is capable of changing so that after post-filtering, the resulting filter characteristic effectively matches the characteristics of a filter used for coarse sampling.
In one embodiment of the present invention, an apparatus is provided for texture filtering with characteristics that continuously vary between a bilinear filter and a box filter. The variations may be based upon, for example, the sampling rate of polygon data and the degree of texture warping. The texture filter behaves like a bilinear filter when the sampling rate per pixel is at the same rate as the desired screen resolution. The texture filter may have the characteristic of a combination of a bilinear filter and a box filter when the sampling rate increases per pixel. The characteristics of the matched texture filter can also be dependent upon the amount of xe2x80x9cstretchingxe2x80x9d or xe2x80x9csqueezingxe2x80x9d of the texture area when polygon data is super-sampled. A texture area is xe2x80x9cstretched outxe2x80x9d when a small texture area (e.g., one texel) fills a big screen area. A texture area is xe2x80x9csqueezedxe2x80x9d when multiple texels are imposed on a small screen area.
In a second embodiment of the present invention, a texture filter is provided that behaves like a trilinear filter when the sampling rate per pixel is at the same rate as the desired screen resolution. The texture filter is a combination of a linear filter (between MIP levels) and a box filter when the sampling rate increases per pixel. As in the first embodiment, the characteristics of the matched texture filter in the second embodiment can also be dependent upon the amount of xe2x80x9cstretchingxe2x80x9d or xe2x80x9csqueezingxe2x80x9d of the texture area when the polygon data is super-sampled.
In a further embodiment, the variation of the filter characteristics between the various filter modes (e.g., bilinear filter, trilinear filter, point sample filter, etc.) is preferably continuous. By continuously varying texture filters between two and artifacts normally visible during animation are eliminated.